package com.jiazhong.mingxing.boot.boot06.test;

import com.jiazhong.mingxing.boot.boot06.bean.Student;
import com.jiazhong.mingxing.boot.boot06.service.StudentService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
@Slf4j
public class App {
    @Resource
    private StudentService studentService;

    @Test
    public void a() {
        Student student = studentService.findStudentById("1971828146351394817");
        log.info("student = {}", student);
    }

    @Test
    public void d() {
        List<Student> allStudent = studentService.findAllStudent();
        allStudent.forEach(student -> {
            log.info("student = {}", student);
        });
    }

    @Test
    public void b() {
        int row = studentService.removeStudentById("1971828146351394817");
        log.info("row = {}", row);
    }

    @Test
    public void c() {
        Student student = new Student();
        student.setId(1965298441470828545L);
        student.setPlaceOfOrigin("陕西西安");
        Student updated = studentService.updateStudent(student);
        log.info("updated = {}", updated);
    }
}
